<template>
    <div>
        父组件{{msg}}
        <DemoComp :data='msg' @changeMsg="changeMsg"></DemoComp>
        <DemoComp>
            :data.sync = 'msg'
        </DemoComp>
    </div>
</template>

<script>
import DemoComp from '@/components/DemoComp'
export default {
    components: {
        DemoComp
    },
    data() {
        return {
            msg: '父组件的信息'
        }
    },
    methods:{
        changeMsg(data){
            alert('调用了父组件的方法,接收到信息',data)
            this.msg = data
        }
    }
}
</script>

<style>

</style>
